package com.tzy.note.base.thread.state;

/**
 * 测试join方法 --> 想像为插队
 */
public class TestJoin {
    public static void main(String[] args) throws InterruptedException {
        Thread thread =new Thread(()->{
            for (int i = 0; i < 1000; i++) {
                System.out.println("线程VIP来了" + i);
            }
        });
        thread.start();

        //主线程
        for (int i = 0; i < 500; i++) {
            if(i == 100){
                thread.join();//插队
            }
            System.out.println("main" + i);
        }
    }
}
